/**
 * resource: 1.html 2.html 3.html 文件内容
 */

const fs = require('fs')
const util = require('util')
const mineReadFile = util.promisify(fs.readFile)

//fs.readFile('./resource/1.html',(err1,data1)=>{
//	if(err1) throw err1
//	fs.readFile('./resource/2.html',(err2,data2)=>{
//		if(err2) throw err2
//		fs.readFile('./resource/3.html',(err3,data3)=>{
//			if(err3) throw err3
//			console.log(data1 + data2 + data3)
//		})
//	})
//})

// async 与 await
async function main(){
	try{
		let data1 = await mineReadFile('./resource/1.html')
		let data2 = await mineReadFile('./resource/2.html')
		let data3 = await mineReadFile('./resource/3.html')
		console.log(data1 + data2 + data3)
	}catch(e){
		console.log(e)
	}
}

main()